#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[]) {

    int n, nums[1024] = {0}, count = 0;
    while (scanf("%d",&n)!=EOF)
    {   
        if(n==0)
            break;
        for (size_t i = 0; i < n; i++)
        {
            int t = 0;
            scanf("%d", &t);
            nums[t] += 1;
        }

        //统计不重复数字总量
        for (size_t i = 0; i < 1024; i++)
        {
            if(nums[i]>0){
                count++;
            }
        }
        printf("%d\n", count);
        //从小到大输出不重复数字
        for (size_t i = 0; i < 1024; i++)
        {
            if(nums[i]>0){
                printf("%lld ", i);
            }
        }
        printf("\n\n");
        memset(nums, 0, 1024);
        count = 0;
    }
    

    return 0;
}